NET MESSAGE PLAYER TO

This command returns the Player Number that the current message is being sent to.

  Syntax
Return Integer=NET MESSAGE PLAYER TO()
  Returns

This command returns the Player Number that the current message is being sent to

  Description

You can use this to determine who the message is for, and whether it is a message for you.

  Example Code
rem Network game can communicate numbers and strings
while inkey$()<>"x"
cls
print "HANDLE NET MESSAGES (Press X To Continue)"
rem Show Latest Return Values
print
print "TO: ";ReturnTo
print "FROM: ";ReturnFrom
print "STRING: ";ReturnString$
rem Send Part
if mouseclick()=1
print "SENDING..."
send net message string 0,"hello world"
endif
rem Receive Part (from all other players)
get net message
if net message exists()=1 then print "RECEIVING..."
while net message exists()=1
ReturnTo=net message player to()
ReturnFrom=net message player from()
if net message type()=3 then ReturnString$=net message string$()
get net message
endwhile
endwhile
  See also

MULTIPLAYER Commands Menu
Index